package com.zhl.service.impl;

import com.zhl.dao.UserfocusDao;
import com.zhl.model.Userfocus;
import com.zhl.service.UserfocusService;

import java.util.List;

public class UserfocusServiceImpl implements UserfocusService {

    UserfocusDao userfocusDao =  new UserfocusDao();

    @Override
    public Integer findUserfocusById(Integer MyId,Integer uId) {
        Integer a = 0;
        Userfocus userfocus = userfocusDao.findUserfocusById(MyId, uId);
        if (userfocus == null){
            Userfocus userfocus1 = new Userfocus();
            userfocus1.setUserId(MyId);
            userfocus1.setUserFocusId(uId);
            userfocusDao.Save(userfocus1);
            a = 1;
            return a;
        }else {
            userfocusDao.deleteUserfocus(MyId,uId);
            a = 0;
        }
        return a;
    }
}
